package com.kx.demo.jdk.collection;

import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeMap;

/**
 * @author kx
 * @date 2020/4/11
 */
public class TreeMapDemo {

    public static void main(String[] args) {
        Map<Integer, String> map = new TreeMap<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return -(o1 - o2);
            }
        });

        map.put(5, "hello");
        map.put(2, "hello");
        map.put(null, "hello");
        map.put(1, "hello");
//        System.out.println(map.get(1));
        System.out.println(map.keySet());
    }

}
